/*
The MIT License (MIT)

Copyright (c) 2013 Mike Dapiran, Brian May, Richard Pospesel, and Bert Wierenga

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software 
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
*/
#pragma once

namespace Hogshead
{
	namespace Common
	{
		/**
		* OutputStream is a pure virtual class which all other Output Stream classes
		* will inherit from.  
		*/
		class OutputStream
		{
		public:
			/**
			* Closes the underlying resources this stream is based on.
			*/
			virtual void close();
			/**
			* Writes any buffered bytes to the stream.
			*/
			virtual void flush();
			/*
			* Writes the passed in char to the stream.  This method is pure virtual
			* and must be overriden by child classes.
			* @param in_char the character to write to the output stream.
			*/
			virtual void write(char in_char) = 0;
			/**
			* Writes a nul terminated character array to the stream.  The default
			* implementation repeatedly calls write(char) in a for loop, so child classes
			* may wish to override this method with a more efficient implementation.
			* @param in_string a nul teriminated array of bytes
			*/
			virtual void write(const char* in_string);

			/**
			* Writes an array of bytes to the output stream.  The default implementation
			* repeatedly calls write(char) in a for loop, so child classes may wish to
			* override this method with one more efficient.
			* @param in_bytes an array of bytes to write to the stream
			* @param in_count number of bytes to write to the stream	
			*/
			virtual void write(const char* in_bytes, unsigned int in_count);
			
			/**
			* Resets the OutputStream to the beginning.  Subsequent writes may overwrite
			* previous writes.  The default implementation does nothing howevver.
			*/
			virtual void reset();
		};
	}
}